package com.sbl.bajw.pc.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sbl.bajw.common.MyBatisDao;
import com.sbl.bajw.mapper.ApartmentDao;
import com.sbl.bajw.pc.model.ApartmentModel;

@Service
public class ApartmentService {
	
	@Resource
    private ApartmentDao dao;
	
	@Resource
	private MyBatisDao gridDao;
	
	public HashMap<String, Object> getModel(String id) throws Exception{
		HashMap<String, Object> model = dao.getModel(id);
		model.put("keyPersionCount", 3);
		return model;
	}
	
	public String getZdryGrid(String id){
		HashMap<String, Object> parm = new HashMap<String, Object>();
		parm.put("id", id);
		String gridResult = gridDao.selectPage(ApartmentDao.class, parm, "getZdryList");
		return gridResult;
	}
	
	public List<HashMap<String, Object>> getModelsByOrg(HashMap<String, Object> parm){
		List<HashMap<String, Object>> models = dao.getModelsByOrgId(parm);
		return models;
	}
	
	public List<HashMap<String, Object>> getZdryModelsByOrgId(HashMap<String, Object> parm){
		List<HashMap<String, Object>> models = dao.getZdryModelsByOrgId(parm);
		return models;
	}
	
	public  List<Map<String, Object>> getCenterCount(HashMap<String, Object> parm){
		 List<Map<String, Object>> result = dao.getCenterCount(parm);
		return result;
	}
	
	public  List<Map<String, Object>> getPACJHApartment(HashMap<String, Object> parm){
		 List<Map<String, Object>> result = dao.getPACJHApartment(parm);
		return result;
	}
	
	public List<ApartmentModel> getAllApartmentModel(){
		List<ApartmentModel> model = dao.getAllApartment();
		return model;
	}
	
	public List<Map<String, Object>> StatisticsByOrgid(HashMap<String, Object> parm){
		List<Map<String, Object>> models = dao.StatisticsByOrgid(parm);
		return models;
	}
	
	public List<Map<String, Object>> StatisticsByXiaoquid(HashMap<String, Object> parm){
		List<Map<String, Object>> models = dao.StatisticsByXiaoquid(parm);
		return models;
	}
	
	public String getAllModelsByOrgGridListPage(HashMap<String, Object> parm){
		String models = gridDao.selectPage(ApartmentDao.class, parm, "getAllModelsByOrg");
		return models;
	}
	
	public String getApartmentByConsListPage(HashMap<String, Object> parm){
		String models = gridDao.selectPage(ApartmentDao.class, parm, "getApartmentByCons");
		return models;
	}
	
	public String getApartmentByOrgListPage(HashMap<String, Object> parm){
		String models = gridDao.selectPage(ApartmentDao.class, parm, "getApartmentByOrg");
		return models;
	}
	
	public int getKeyPersionCount(String builderCode){
		int count = dao.getKeyPersionCount(builderCode);
		return count;
	}
	
	public List<Map<String, Object>> getCenterCountByXiaoqu(HashMap<String, Object> parm){
		List<Map<String, Object>> result = dao.getCenterCountByXiaoqu(parm);
		return result;
	}
	
	public List<Map<String, Object>> getMainTypeCount(HashMap<String, Object> parm){
		List<Map<String, Object>> list = dao.getMainTypeCount(parm);
		return list;
	}
	
	public List<Map<String, Object>> getCountByBuildingType(HashMap<String, Object> parm){
		List<Map<String, Object>> list = dao.getCountByBuildingType(parm);
		return list;
	}
	
	public List<Map<String, Object>> getAll(HashMap<String, Object> parm){
		List<Map<String, Object>> list = dao.getAll(parm);
		return list;
	}
	
	public String getModelByGridConditions(HashMap<String, Object> parm){
		String list = gridDao.selectPage(ApartmentDao.class, parm, "getModelByGridConditions");
		return list;
	}
	
	public List<Map<String, Object>> getCountByFullid(HashMap<String, Object> parm){
		List<Map<String, Object>> list = dao.getCountByFullid(parm);
		return list;
	}
}

